package com.kob.backend.controller.user.account;

import com.kob.backend.service.user.account.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class RegisterController {
    @Autowired
    private RegisterService registerService;//把service注入进来

    @PostMapping("/user/account/register/")//密文
    public Map<String,String> register(@RequestParam Map<String,String> map){//参数中注解：从前端获取参数
        String username=map.get("username");//从map里面提取用户名
        String password=map.get("password");
        String confirmedPassword=map.get("confirmedPassword");
        return registerService.register(username,password,confirmedPassword);//返回user注册数据
    }
}
